package com.spring.domain;

public class ResultBean {
    private int code;
    private ProductBean data;
    private String msg;

    public ResultBean(){

    }
    public ResultBean(int code, ProductBean data, String msg){
        this.code = code;
        this.data = data;

        this.msg = msg;
    }

    public static ResultBean ofSuccess(ProductBean obj){
        ResultBean ret = new ResultBean();
        ret.setCode(200);
        ret.setData(obj);
        return ret;
    }

    public  static ResultBean ofSuccess(String msg){
        ResultBean ret = new ResultBean();
        ret.setMsg(msg);
        ret.setCode(200);
        return ret;
    }

    public static ResultBean ofSuccess(ProductBean obj,String msg){
        ResultBean ret=new ResultBean();
        ret.setCode(200);
        ret.setData(obj);
        ret.setMsg(msg);
        return ret;
    }
    public static ResultBean ofSuccess(){
        ResultBean ret=new ResultBean();
        ret.setCode(200);
        return ret;
    }
    public static ResultBean ofFail(int code,String desc){
        ResultBean ret=new ResultBean();
        ret.setCode(code);
        ret.setMsg(desc);
        return ret;
    }


    //    下面全是set和get方法
    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public ProductBean getData() {
        return data;
    }

    public void setData(ProductBean data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

}
